﻿@model projectManagementWeb.Models.ProjectLeader.ProjectLeaderReportFormModel

@{
    ViewBag.Title = "Project Leader Reports";
}

<p align="right">
    @Html.ActionLink("<< Regresar", "Index")
</p>


<h2>Reportes del líder de proyecto:</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")" type="text/javascript"></script>


<head>
    <script language="javascript" type="text/javascript">

        function enable(enabled) {
            if (enabled == true) {
                $('#units').show();
                $('#type').hide();
            }
            else {
                $('#units').hide();
                $('#type').show();
            }
        }

        function toggleDropDown() {


            if (document.getElementById("moduleID").selectedIndex > 0) {
                document.getElementById("developerID").disabled = true;
            }
            if (document.getElementById("developerID").selectedIndex > 0) {
                document.getElementById("moduleID").disabled = true;
            }
            if (document.getElementById("moduleID").selectedIndex == 0) {
                document.getElementById("developerID").disabled = false;
            }
            if (document.getElementById("developerID").selectedIndex == 0) {
                document.getElementById("moduleID").disabled = false;
            }

            //alert(document.getElementById("moduleID").selectedIndex); 
            //alert(document.getElementById("moduleID"));
            //alert(document.getElementById("moduleID").options[document.getElementById("moduleID").selectedIndex].value);

        }

        function updateDropDowns() {
            var selectModule = $("#moduleID");
            var selectResource = $("#developerID");


            $("#moduleID").prepend($('<option/>', {
                value: 0,
                text: "-- Todos --"
            }));

            $("#developerID").prepend($('<option/>', {
                value: 0,
                text: "-- Todos --"
            }));

            $("#moduleID").val(0);
            $("#developerID").val(0);

        }

        $(document).ready(

	    function () {
	        updateDropDowns();
	    });   
           
    </script>

</head>

<br />

<body onload="enable(true);">

@using (Html.BeginForm("ProjectLeaderReportsForm", "ProjectLeader", FormMethod.Post))

{
    <div>
           <input type="submit" value="Generar Reporte" />
    </div>
    
    
     <div>
        <fieldset class="nested-Panel">
            <legend>Tipo de Reporte:</legend>
            <p>@Html.RadioButtonFor(m => m.reportType, "ValorGanado", new { @checked = true, @onClick = "enable(true);" }) Valor Ganado </p>
            <p>@Html.RadioButtonFor(m => m.reportType, "Tareas", new { @onclick = "enable(false);" }) Tareas en Progreso </p>
        </fieldset>

        <fieldset class="nested-Panel" id="units">
            <legend>Unidades:</legend>
            <p>@Html.RadioButtonFor(m => m.units, "Porcentaje", new { @id = "uniRBP", @checked = true }) Por Porcentaje </p>
            <p>@Html.RadioButtonFor(m => m.units, "Horas", new { @id = "uniRBH" }) Por Horas de Construcción </p>
        </fieldset>

        <fieldset class="nested-Panel" id="type">
            <legend>Detalle:</legend>
            <p>@Html.RadioButtonFor(m => m.detail, "Individual", new { @id = "detailT", @name = "detailrep", @checked = true }) Tareas individuales </p>
            <p>@Html.RadioButtonFor(m => m.detail, "Total", new { @id = "detailI", @name = "detailrep" }) Total de tareas </p>
        </fieldset>

    </div>
    
    <div>
         <fieldset>
            <legend>Visibilidad:</legend>
            <p> Por Módulo: <span style="position: absolute; left:200px"> @Html.DropDownListFor(m => m.moduleID, new SelectList(ViewBag.modules, "ID", "Name"), new { id = "moduleID", @onChange = "toggleDropDown();" }) </span> </p> 
            <p> Por Recurso: <span style="position: absolute; left:200px">  @Html.DropDownListFor(m => m.resourceID, new SelectList(ViewBag.resources, "userID", "FullName"), new { id = "developerID", @onChange = "toggleDropDown();" }) </span> </p>
        </fieldset>.
    </div>

}
</body>